package com.hxkj.domain.enums;

import com.platform.common.domain.exception.CustomExceptionCode;

/**
 * 用户异常枚举
 * <p>
 * Created by chenwei on 2017/6/21.
 */
public enum SiteExceptionEnum implements CustomExceptionCode {

    SITE_NOT_ID(600, "站点id为空", 900),
    SITE_NOT_NAME(601, "站点名称为空", 900),
    SITE_NOT_MSG(602, "站点不存在", 900),
    MODIFLY_SITE_ERROR(603, "站点名称重复", 900),
    SITE_DELTAG_ERROR(604, "站点已经存在，请联系超级管理员重新激活即可使用！", 900),
    SITE_GET_ERROR(605, "查询站点失败！", 900),
    SITE_MODIFY_ERROR(606, "修改站点失败！", 900),
    SITE_REMOVE_ERROR(607, "删除站点失败！", 900),
    SITE_ADD_ERROR(608, "新增站点失败！", 900),
    SITE_SITESTATUS_NULL(609, "新增站点失败！", 900),

    ;
    private Integer code;
    private String msg;
    private Integer httpCode;

    SiteExceptionEnum(Integer code, String msg, Integer httpCode) {
        this.code = code;
        this.msg = msg;
        this.httpCode = httpCode;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public Integer getHttpCode() {
        return httpCode;
    }

    @Override
    public void setHttpCode(Integer httpCode) {
        this.httpCode = httpCode;
    }


    public static SiteExceptionEnum getEnumByCode(Integer code){
        for(SiteExceptionEnum siteExceptionEnum : SiteExceptionEnum.values()){
            if(code.equals(siteExceptionEnum.getCode())){
                return siteExceptionEnum;
            }
        }
        return null;
    }
}
